package com.itheima.service.Impl;

import com.itheima.mapper.ReportMapper;
import com.itheima.pojo.JobOption;
import com.itheima.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.Objects;

@Service
public class ReportServiceImpl implements ReportService {

    @Autowired
    ReportMapper reportMapper;
    @Override
    public JobOption getEmpJobData() {

        List<Map<String, Object>> list = reportMapper.getEmpJobData();

        List<Object> jobList = list.stream().map(dataMap -> dataMap.get("pos")).toList();
        List<Object> dataList = list.stream().map(dataMap -> dataMap.get("total")).toList();
        return new JobOption(jobList, dataList);

    }

    @Override
    public List<Map<String, Object>> getEmpGenderData() {
        return reportMapper.getEmpGenderData();
    }


}
